package com.isoft.farm.controller;

import com.isoft.farm.common.JsonResult;
import com.isoft.farm.entity.ImageVO;
import com.isoft.farm.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("image")
public class imgController {
    @Autowired
    ImageService imageService;
    @RequestMapping("/imgFile")
    public JsonResult file(MultipartFile file) throws IOException {
        //调用业务层
        System.out.println(file);
        ImageVO img = imageService.upload(file);
        return new JsonResult(img);

    }
}
